package com.jiangyg.mall.member.service;

import com.jiangyg.mall.core.support.restful.Pagination;
import com.jiangyg.mall.db.mybatis.BaseServiceImpl;
import com.jiangyg.mall.member.dao.IntegrationChangeHistoryDao;
import com.jiangyg.mall.member.dto.IntegrationChangeHistoryDTO;
import com.jiangyg.mall.member.entity.IntegrationChangeHistory;
import com.jiangyg.mall.member.vo.IntegrationChangeHistoryVO;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class IntegrationChangeHistoryServiceImpl extends BaseServiceImpl<IntegrationChangeHistoryDao, IntegrationChangeHistory> implements IntegrationChangeHistoryService {

    @Autowired
    public IntegrationChangeHistoryServiceImpl(IntegrationChangeHistoryDao integrationChangeHistoryDao) {
        super(integrationChangeHistoryDao);
    }

    @Override
    @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
    public Pagination<IntegrationChangeHistoryVO> selectPagination(Pagination<IntegrationChangeHistoryVO> pagination) throws Exception {
        return this.executeSelectPagination(pagination, IntegrationChangeHistoryVO.class);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean saveOrUpdate(IntegrationChangeHistoryDTO dto) throws Exception {
        return this.executeSaveOrUpdate(dto) > 0;
    }

    @Override
    @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
    public IntegrationChangeHistoryVO selectById(Long integrationChangeHistoryId) throws Exception {
        return this.executeSelectById(integrationChangeHistoryId, IntegrationChangeHistoryVO.class);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean delete(List<Long> integrationChangeHistoryIds) {
        return this.baseMapper.deleteBatchIds(integrationChangeHistoryIds) > 0;
    }

}
